package com.savitar.account.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;
import lombok.ToString;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.io.Serializable;
import java.util.Collection;

/**
 * (Account)实体类
 *
 * @author Savitar
 * @since 2021-05-14 16:07:45
 */
@ToString(callSuper = true)
@Data
@TableName("t_account")
public class Account extends Model<Account> implements UserDetails {
    private static final long serialVersionUID = -12579279393610458L;
    /**
    * 主键
    */
    @TableId
    private String pkId;
    /**
    * 用户名
    */
    private String username;
    /**
    * 密码
    */
    private String password;
    /**
    * 邮箱
    */
    private String email;
    /**
    * 手机号码
    */
    private String phone;
    /**
    * 性别
    */
    private String gender;
    /**
    * 年龄
    */
    private Integer age;
    /**
    * 角色id
    */
    private String roleId;
    /**
    * 姓名
    */
    private String name;

    @TableField(exist = false)
    private String roleName;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}